package ai.weed.qrcode.controller;

import ai.weed.qrcode.common.Response;
import ai.weed.qrcode.service.SubscribeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 消息订阅接口
 *
 * @author zhong.wang
 * @date 2025/11/3
 **/

@RestController
@RequestMapping("/subscribe")
public class SubscribeController {

    @Resource
    private SubscribeService subscribeService;

    /**
     * 发送消息
     * @param openid
     * @return
     */

    @GetMapping("/send")
    public Response<Boolean> send(String openid) {
        try {
            boolean result = subscribeService.sendMessage(openid);
            return Response.success(result);
        } catch (Exception e) {
            return Response.success(false);
        }
    }

}
